package com.ean.backpack.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;

import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.springframework.beans.factory.annotation.Configurable;

@Embeddable
@Configurable
public final class RoomtypelistPK implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7401374001157287078L;
	
	public RoomtypelistPK() {
		super();
	}

	@Column(name = "EANHotelID", nullable = false)
	private Integer eanhotelId;

	@Column(name = "RoomTypeID", nullable = false)
	private Integer roomTypeId;

	public RoomtypelistPK(Integer eanhotelId, Integer roomTypeId) {
		super();
		this.eanhotelId = eanhotelId;
	}

	public Integer getEanhotelId() {
		return eanhotelId;
	}

	public Integer getRoomTypeId() {
		return roomTypeId;
	}

	@Override
	public String toString() {
		return ReflectionToStringBuilder.toString(this,
				ToStringStyle.SHORT_PREFIX_STYLE);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((eanhotelId == null) ? 0 : eanhotelId.hashCode());
		result = prime * result
				+ ((roomTypeId == null) ? 0 : roomTypeId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		RoomtypelistPK other = (RoomtypelistPK) obj;
		if (eanhotelId == null) {
			if (other.eanhotelId != null)
				return false;
		} else if (!eanhotelId.equals(other.eanhotelId))
			return false;
		if (roomTypeId == null) {
			if (other.roomTypeId != null)
				return false;
		} else if (!roomTypeId.equals(other.roomTypeId))
			return false;
		return true;
	}

}
